package com.cloud.rocketmq.listener;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @author: Dream_xun
 * @date: 2020-12-18 0:36
 * @description:
 */
@RocketMQMessageListener(topic = "spring-boot-rocket",consumerGroup = "${rocketmq.producer.group}")  // 监听的消息主题;consumeMode（消费模型:有并发，有广播，负载均衡） = ConsumeMode.ORDERLY 负载均衡的
@Component
@Slf4j
public class Consumer implements RocketMQListener<String> {
    @Override
    public void onMessage(String s) {
        log.info("消费者启动成功...");
        System.out.println(s);
    }
}
